home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / Aliases.p < prev    next >
Text File  |  1995-09-12  |  5KB  |  141 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 5:12:31 PM }
  2. {
  3.      File:        Aliases.p
  4.  
  5.      Contains:    Alias Manager Interfaces.
  6.  
  7.      Version:    Technology:    System 7.5
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT Aliases;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __ALIASES__}
  26. {$SETC __ALIASES__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types, AppleTalk, Files;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     rAliasType                    = 'alis';                        { Aliases are stored as resources of this type }
  37. { define alias resolution action rules mask }
  38.     kARMMountVol                = $00000001;                    { mount the volume automatically }
  39.     kARMNoUI                    = $00000002;                    { no user interface allowed during resolution }
  40.     kARMMultVols                = $00000008;                    { search on multiple volumes }
  41.     kARMSearch                    = $00000100;                    { search quickly }
  42.     kARMSearchMore                = $00000200;                    { search further }
  43.     kARMSearchRelFirst            = $00000400;                    { search target on a relative path first }
  44. { define alias record information types }
  45.     asiZoneName                    = -3;                            { get zone name }
  46.     asiServerName                = -2;                            { get server name }
  47.     asiVolumeName                = -1;                            { get volume name }
  48.     asiAliasName                = 0;                            { get aliased file/folder/volume name }
  49.     asiParentName                = 1;                            { get parent folder name }
  50.  
  51. { define the alias record that will be the blackbox for the caller }
  52.  
  53. TYPE
  54.     AliasRecord = RECORD
  55.         userType:                OSType;                                    { appl stored type like creator type }
  56.         aliasSize:                INTEGER;                                { alias record size in bytes, for appl usage }
  57.     END;
  58.  
  59.     AliasPtr = ^AliasRecord;
  60.     AliasHandle = ^AliasPtr;
  61.  
  62. { alias record information type }
  63.     AliasInfoType = INTEGER;
  64.  
  65.     AliasFilterProcPtr = ProcPtr;  { FUNCTION AliasFilter(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr): BOOLEAN; }
  66.     AliasFilterUPP = UniversalProcPtr;
  67.  
  68. CONST
  69.     uppAliasFilterProcInfo = $00000FD0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 1 byte result; }
  70.  
  71. FUNCTION NewAliasFilterProc(userRoutine: AliasFilterProcPtr): AliasFilterUPP;
  72.     {$IFC NOT GENERATINGCFM }
  73.     INLINE $2E9F;
  74.     {$ENDC}
  75.  
  76. FUNCTION CallAliasFilterProc(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr; userRoutine: AliasFilterUPP): BOOLEAN;
  77.     {$IFC NOT GENERATINGCFM}
  78.     INLINE $205F, $4E90;
  79.     {$ENDC}
  80.  
  81. FUNCTION NewAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  82.     {$IFC NOT GENERATINGCFM}
  83.     INLINE $7002, $A823;
  84.     {$ENDC}
  85. { create a minimal new alias for a target and return alias record handle }
  86. FUNCTION NewAliasMinimal({CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  87.     {$IFC NOT GENERATINGCFM}
  88.     INLINE $7008, $A823;
  89.     {$ENDC}
  90. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  91. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER; fullPath: UNIV Ptr; zoneName: ConstStr32Param; serverName: ConstStr31Param; VAR alias: AliasHandle): OSErr;
  92.     {$IFC NOT GENERATINGCFM}
  93.     INLINE $7009, $A823;
  94.     {$ENDC}
  95. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  96. FUNCTION ResolveAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  97.     {$IFC NOT GENERATINGCFM}
  98.     INLINE $7003, $A823;
  99.     {$ENDC}
  100. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  101. FUNCTION GetAliasInfo(alias: AliasHandle; index: AliasInfoType; VAR theString: Str63): OSErr;
  102.     {$IFC NOT GENERATINGCFM}
  103.     INLINE $7007, $A823;
  104.     {$ENDC}
  105.   Given a file spec, return target file spec if input file spec is an alias.
  106.   It resolves the entire alias chain or one step of the chain.  It returns
  107.   info about whether the target is a folder or file; and whether the input
  108.   file spec was an alias or not. 
  109. }
  110. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec; resolveAliasChains: BOOLEAN; VAR targetIsFolder: BOOLEAN; VAR wasAliased: BOOLEAN): OSErr;
  111.     {$IFC NOT GENERATINGCFM}
  112.     INLINE $700C, $A823;
  113.     {$ENDC}
  114. FUNCTION FollowFinderAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; logon: BOOLEAN; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $700F, $A823;
  117.     {$ENDC}
  118.    Low Level Routines 
  119.  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  120. }
  121. FUNCTION MatchAlias(fromFile: ConstFSSpecPtr; rulesMask: LONGINT; alias: AliasHandle; VAR aliasCount: INTEGER; aliasList: FSSpecArrayPtr; VAR needsUpdate: BOOLEAN; aliasFilter: AliasFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  122.     {$IFC NOT GENERATINGCFM}
  123.     INLINE $7005, $A823;
  124.     {$ENDC}
  125. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  126. FUNCTION UpdateAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; alias: AliasHandle; VAR wasChanged: BOOLEAN): OSErr;
  127.     {$IFC NOT GENERATINGCFM}
  128.     INLINE $7006, $A823;
  129.     {$ENDC}
  130.  
  131. { $ALIGN RESET}
  132. { $POP}
  133.  
  134. {$ENDC} {__ALIASES__}
  135.  
  136.  IMPLEMENTATION
  137.  END.
  138.  
  139.